// 统一管理项目接口地址
import axios from '@/request/request'
import qs from 'qs'

// 获取精品推荐的数据  设置成函数,为了预防导入时引用所有的接口
export const JingpinAPI = () => axios.get('/products/recommend');

// 获取热门
export const RemenAPI = () => axios.get('/products/hot');

// 发送短信
export const SendSMSAPI = (params) => axios.post('/sendSMS', qs.stringify(params));

// 获取验证码
export const phoneReginAPI = (params) => axios.post('/phoneRegin', qs.stringify(params));

// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginApi = (params) => axios.post(`/wechatUsers/PCLogin`, qs.stringify(params));

// 手机号关联微信的请求
export const BinddingApi = (params) => axios.post(`/wechatUsers/binding`, qs.stringify(params));

// 用户信息
export const UserApi = () => axios.get(`/shop/userProfiles`);

// 商品详情
export const GoodshopApi = (id) => axios.get(`/products/${id}`);

// 加入购物车
export const shopAddApi = (params) => axios.post(`/shop/carts/add`, qs.stringify(params));

// 全部商品 请求体
export const GoodsApi = (params) => axios.get(`/products`, { params });

// 查看购物车
export const cartsApi = () => axios.get(`/shop/carts`);

// 删除商品
export const delShopApi = (id) => axios.delete(`/shop/carts?productIds=${id}`);